<?php

get_header(); // Loads the header.php template. ?>		
		
		<div id="main" class="<?php echo $cv_option['blog_layout']; ?> clearfix">	
			
			<div id="single-trending-story" class="clearfix">
		
			<h3 class="trending-title title-small"><span>Trending Story</span></h3>
			
			<?php 
			$i=0;
			$key = '_meters_trending_story';					
			$args = array(							
				'meta_query' => array(
					array(
						'key' => $key,
						'value' => 'on',
						'compare' => 'LIKE')								
					),
				'showposts' => 3
				);
			query_posts($args);
			if(have_posts()) : while (have_posts()) : the_post(); $i++;?> 
		
			
				<div class="hentry <?php if($i==3) echo 'right';?>">
					
					<div class="entry-img">
						<?php if ( current_theme_supports( 'get-the-image' ) ) {
										
							$thumb2 = get_the_image( array( 'format' => 'array', 'echo' => false, 'custom_key' => array( 'Thumbnail', 'thumbnail' ), 'default_size' => 'entry-image-thumb', 'default_image' => get_bloginfo ( 'template_url' ) . '/images/'. 'entry-image-thumb.png') );  
												
							if(!empty($thumb2['src'])) { ?>
								<a href="<?php echo esc_url(get_permalink());?>"><img src="<?php echo $thumb2['src'];?>"></a>													
							<?php } 											
						} ?>						
					</div><!-- .hentry-img -->		
					
					<div class="entry-right">
						<div class="title">							
							<a href="<?php echo get_permalink(); ?>" class="entry-title"><?php echo the_title(); ?></a>
							<span class="comments-link"><a href="<?php echo get_comments_link();?>"><?php echo get_comments_number();?></a></span>	
							<?php if($cv_option['sc_disable_socials'] != true) { ?>
								<div class="social-media"><?php echo cv_wpsocialite_markup('small', 2); ?></div>
							<?php } ?>
						</div>						
									
					</div>		
								
				</div><!-- .hentry -->			
			<?php endwhile; ?>						
			<?php endif; ?>
			<?php wp_reset_query(); ?>
		</div><!-- #trending-story -->			
			
			<div class="center">			
				<div id="content" class="clearfix">
						
						<?php if ( have_posts() ) : ?>
							<?php global $entry_count; $entry_count = 0; ?>
							<?php while ( have_posts() ) : the_post(); $entry_count++;?>					

							   <?php get_template_part('entry-single'); ?>
								
							<?php endwhile; ?>								

						<?php else : ?>
							<?php get_template_part('no-results'); ?>				
						<?php endif; ?>					
							
			
				</div> <!-- #content -->		
			
				<?php get_sidebar( 'primary' );  ?>	
				
				<div class="clear"></div>		
			
				<div class="story-nav clearfix">
					<?php global $post; $previous_post = get_previous_post(); $next_post = get_next_post(); ?>
					<div class="previous">
						<a href="<?php echo get_permalink($previous_post->ID);?>" class="link">&laquo; Previous Story</a>
						<h3 class="entry-title"><a href="<?php echo get_permalink($previous_post->ID);?>"><?php echo $previous_post->post_title;?></a></h3>
					</div>
					<div class="next">
						<a href="<?php echo get_permalink($next_post->ID);?>" class="link">Next Story &raquo;</a>						
						<h3 class="entry-title"><a href="<?php echo get_permalink($next_post->ID);?>"><?php echo $next_post->post_title;?></a></h3>						
					</div>
					
				</div>				

			</div><!-- .center -->
			
		</div><!-- #main -->		
	
	
<?php get_footer(); // Loads the footer.php template. ?>		